<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <div th:replace="admin/head :: head"></div>
    <title>角色管理</title>
</head>

<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a th:href="@{/admin}">首页</a>
        <a th:href="@{/admin/permission}">用户权限</a>
        <a>
          <cite>角色管理</cite>
        </a>
      </span>
</div>
<div class="x-body">
    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" th:action="@{/admin/permission/role/list}" method="post">
            <input type="text" name="name" placeholder="请输入角色名" autocomplete="off" class="layui-input">
            <button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </form>
    </div>
    <xblock>
        <button class="layui-btn layui-btn-danger" onclick="del('/admin/permission/role/delete/')"><i class="layui-icon"></i>批量删除
        </button>
        <button class="layui-btn" onclick="x_admin_show('添加角色','/admin/permission/role/form')"><i class="layui-icon"></i>添加
        </button>
        <a class="layui-btn layui-btn-small" href="javascript:location.replace(location.href);" title="刷新">
            <i class="layui-icon">ဂ</i>
        </a>
        <span class="x-right" style="line-height:40px" th:text="|共有数据: ${roles.size()} 条|"></span>
    </xblock>
    <table class="layui-table">
        <thead>
        <tr>
            <th>
                <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i
                        class="layui-icon">&#xe605;</i></div>
            </th>
            <th>ID</th>
            <th>角色名</th>
            <th>描述</th>
            <th>等级</th>
            <th>操作</th>
        </thead>
        <tbody>
        <tr th:each="item:${roles}">
            <td>
                <div class="layui-unselect layui-form-checkbox" lay-skin="primary" th:attr="data-id=${item.id}"><i
                        class="layui-icon">&#xe605;</i></div>
            </td>
            <td th:text="${item.id}"></td>
            <td th:text="${item.name}"></td>
            <td th:text="${item.description}"></td>
            <td th:text="${item.level}"></td>
            <td class="td-manage">
                <a title="编辑" th:onclick="'onclick=x_admin_show(\'编辑\',\'/admin/permission/role/form?id=' + ${item.id} + '\')'" href="javascript:;">
                    <i class="layui-icon">&#xe642;</i>
                </a>
                <a title="删除" th:onclick="'del(\'/admin/permission/role/delete/\',' + ${item.id} + ')'"
                   href="javascript:;">
                    <i class="layui-icon">&#xe640;</i>
                </a>
            </td>
        </tr>
        </tbody>
    </table>

</div>
<script>
    layui.use('form', function () {
        var form = layui.form;
        form.on('submit(search)', function() {
            this.submit();
        })
    });
</script>
</body>

</html>